// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './vuex/store.js'
import axios from 'axios'
import '../static/js/flexible.js'
import MuseUI from 'muse-ui'
import 'muse-ui/dist/muse-ui.css'
import 'typeface-roboto'
import '@/assets/css/material-icons.css'
import '@/assets/iconfont/iconfont.css'
import Toast from 'muse-ui-toast'
import Message from 'muse-ui-message';
import 'muse-ui-message/dist/muse-ui-message.css';
import VueWechatTitle from 'vue-wechat-title'



Vue.use(MuseUI)
Vue.config.productionTip = false
Vue.prototype.$http = axios //全局注册axios,改写成Vue原型属性,可以在每个组件中使用this.$http这种方式

//引入toast提示插件
const ToastOption ={
  position:'top',//弹出位置
  time:1500,//显示时长
  closeIcon:'close',//关闭图标
  successIcon:'check_circle',//成功信息图标
  infoIcon: 'info', // 信息信息图标
  warningIcon: 'priority_high', // 提醒信息图标
  errorIcon: 'warning' // 错误信息图标
}
Vue.use(Toast,ToastOption)
/*引入message模态弹框提示*/
Vue.use(Message)

//动态修改页面的title
Vue.use(VueWechatTitle)


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})

//监听点击浏览器返回按钮
window.addEventListener('popstate',function (e) {
  router.togoback()
},false)

/**权限指令**/
/*Vue.directive('has', {
  bind: function(el, binding) {
    if (!Vue.prototype.$_has(binding.value)) {
      el.parentNode.removeChild(el);
    }
  }
});*/
//权限检查方法
/*Vue.prototype.$_has = function(value) {
  let isExist=false;
  let buttonpermsStr=localStorage.getItem("perms");
  if(buttonpermsStr==undefined || buttonpermsStr==null){
    return false;
  }
  let buttonperms=JSON.parse(buttonpermsStr);
  for(let i=0;i<buttonperms.length;i++){
    if(buttonperms[i].perms.indexOf(value)>-1){
      isExist=true;
      break;
    }
  }
  return isExist;
};*/
